package com.changgou.search.controller;

import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import com.changgou.search.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wcollect")
public class CollectController {

    @Autowired
    private CollectService collectService;

    /**
     * 收藏功能
     * @param skuId
     * @return
     */
    @GetMapping("/{skuId}")
    public Result collect(@PathVariable("skuId") String skuId){
        //TokenDecode tokenDecode =new TokenDecode();
        collectService.collect(skuId,"heima");  //todo 用户名写死了,后面需要用tokenDecode动态获取用户名
        return new Result(true, StatusCode.OK,"收藏成功");
    }
}
